﻿$(document).ready(function () {
    $('[id$="DateStartTextBox"]').datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: "yy-mm-dd"
    });
    $('[id$="DateEndTextBox"]').datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: "yy-mm-dd"
    });


    var fullDate = new Date();

    var twoDigitDay = ((fullDate.getDate()) > 9) ? (fullDate.getDate()) : '0' + (fullDate.getDate());

    var twoDigitMonth = ((fullDate.getMonth()) > 8) ? (fullDate.getMonth() + 1) : '0' + (fullDate.getMonth() + 1);

    $('[id$="DateStartTextBox"]').val(fullDate.getFullYear() + '-' + twoDigitMonth + '-01');
    $('[id$="DateEndTextBox"]').val(fullDate.getFullYear() + '-' + twoDigitMonth + '-' + twoDigitDay);

    $('[id$="btnExport"').click(function () {
        $("#messageLabel").text("");
    });

});